﻿namespace SBlogCore.Entitys.SystemManager
{
    public class SysFileMap : CreateEntity, IEntityTypeConfiguration<SysFileMap>
    {
        /// <summary>
        /// 文件信息
        /// </summary>
        public SysFileInfo? SysFileInfo { get; set; }
        /// <summary>
        /// 文件ID
        /// </summary>
        [Comment("文件ID")]
        public long? SysFileInfoId { get; set; }
        /// <summary>
        /// 数据ID
        /// </summary>
        [Comment("数据ID")]
        public long? DataId { get; set; }
        /// <summary>
        /// Key
        /// </summary>
        [Comment("Key")]
        public string? Key { get; set; }

        public void Configure(EntityTypeBuilder<SysFileMap> builder)
        {
            builder.HasOne(w => w.SysFileInfo).WithOne(w => w.SysFileMap)
                .HasForeignKey<SysFileMap>(w => w.SysFileInfoId);
        }
    }
}
